<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Авторизация</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<BASE HREF="<?=base_url()?>">
	<link rel="stylesheet" type="text/css" href="<?=config_item('css_path')?>css/login.css" />
	<script type="text/javascript" src="<?=config_item('js_path')?>js/jquery-1.3.2.min.js"></script>
	<script language="javascript">
	base_url = '<?=base_url()?>';
	</script>
</head>
<body onload="document.getElementById('login').focus();">

<div class='center' id='fblock'>
	<form action="" method="post" id='f'>
		<table>
		<?php if(@$error) {?>
			<tr>
				<td align=center style="color:red" colspan=2><?=$error?></td>
			</tr>
		<?php } ?>
			<tr>
				<td>E-mail:</td>
				<td><input type="text" id="login" name="login_user" /></td>
			</tr>
			<tr>
				<td>Пароль:</td>
				<td><input type="password" id="password" name="login_password" /></td>
			</tr>
			<tr>
				<td align=center colspan=2><input type='submit' value='Войти' class='submit'></td>
			</tr>
		</table>
	</form>
	<table>
		<tr>
			<td align=center><a href='#' onclick="changeBlock('2'); return false;">Восстановление пароля</a></td>
	<!-- 		<td>Регистрация</td> -->
		</tr>
	</table>
</div>

<div class='center' id='f2block' style='display:none;'>
	<table>
		<tr>
			<td>E-mail:</td>
			<td><input type="text" id="forgot_login" /></td>
		</tr>
		<tr>
			<td align=center colspan=2><input type='button' value='Восстановить' class='submit' onclick="forgot();"></td>
		</tr>
	</table>
	<table>
		<tr>
			<td align=center><a href='#' onclick="changeBlock(''); return false;">Войти</a></td>
		</tr>
	</table>
</div>

<div id="overlay" style='display:none;'></div>
<img src='<?=config_item('image_path')?>images/loading.gif' id='loading' style='display:none;'>

	
<script type="text/javascript"> 

function forgot()
{
	var email = document.getElementById('forgot_login').value;
	if(email != '')
	{
		showOverlay(true);
		$.ajax({
			url: base_url + 'ajax/forgot_password/',
			type: 'POST',
			data: {email:email},
			success: function(data)
			{			
				showOverlay(false);
				changeBlock('')
				alert(data);
			}
		});
	}
	else
	{
		alert('Введите e-mail');
	}
}

function changeBlock(num)
{
	document.getElementById('fblock').style.display = num == '' ? '' : 'none';
	document.getElementById('f2block').style.display = num == '2' ? '' : 'none';
}

function showOverlay(show)
{
	document.getElementById('overlay').style.display = show ? "" : "none";
	document.getElementById('loading').style.display = show ? "" : "none";
}

</script>	

  </body>

  </html>